package br.com.cardoso.videostore.web.jsf;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.cardoso.web.jsf.ManagedBeanBasic;
import org.cardoso.web.jsf.component.Paginator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import br.com.cardoso.videostore.application.PersistenceName;
import br.com.cardoso.videostore.model.entity.CategoryEntity;
import br.com.cardoso.videostore.persistence.ICategoryPersistence;

@ManagedBean(name = "categoryMB")
@ViewScoped
public class CategoryMB extends ManagedBeanBasic<CategoryEntity> {

	private static final long serialVersionUID = 1L;
	
	@Autowired
	@Qualifier(PersistenceName.CATEGORY_PERSISTENCE)
	private ICategoryPersistence persistence;
	
	public CategoryMB() {
		super(CategoryEntity.class);
		this.paginator = new Paginator(this);
		initComponents();
		refreshGrid();
	}

	@Override
	protected ICategoryPersistence getPersistence() {
		return persistence;
	}
	
	public CategoryEntity getEntity() {
		return (CategoryEntity) super.getEntity();
	}
	
	public void setEntity(CategoryEntity categoryEntity) {
		super.setEntity(categoryEntity);
	}

}